/*
 * @(#)MaintWorkflowStageForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.workflow.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.workflow.bean.WorkflowStage;

/**
 MaintWorkflowStageForm.java

 This class is the for web form purpose.

 @author      dick xie
 @company     DCIVision Limited
 @creation date   08/06/2005
 @version     $Revision: 1.3 $
 */

public class MaintWorkflowStageForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.3 $";

  private String workflowRecordID = null;
  
  private String workflowGroupID = null;

  private String stageName = null;

  private String duration = null;

  private String[] relatedStepIDs = null;

  private String[] isNotPending = null;

  public MaintWorkflowStageForm() {
    super();
  }

  public String getWorkflowRecordID() {
    return (this.workflowRecordID);
  }

  public void setWorkflowRecordID(String workflowRecordID) {
    this.workflowRecordID = workflowRecordID;
  }

  public String getStageName() {
    return (this.stageName);
  }

  public void setStageName(String stageName) {
    this.stageName = stageName;
  }

  public String getDuration() {
    return (this.duration);
  }

  public void setDuration(String duration) {
    this.duration = duration;
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public String[] getRelatedStepIDs() {
    return relatedStepIDs;
  }

  public void setRelatedStepIDs(String[] relatedStepIDs) {
    this.relatedStepIDs = relatedStepIDs;
  }

  public String[] getIsNotPending() {
    return isNotPending;
  }

  public void setIsNotPending(String[] isNotPending) {
    this.isNotPending = isNotPending;
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    //this.setWorkflowRecordID(null);
    this.setStageName(null);
    this.setDuration(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    WorkflowStage tmpWorkflowStage = new WorkflowStage();
    tmpWorkflowStage.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpWorkflowStage.setWorkflowRecordID(TextUtility.parseIntegerObj(this
        .getWorkflowRecordID()));
    tmpWorkflowStage.setStageName(this.getStageName());
    tmpWorkflowStage.setDuration(TextUtility
        .parseIntegerObj(this.getDuration()));
    tmpWorkflowStage.setRecordStatus(this.getRecordStatus());
    tmpWorkflowStage.setUpdateCount(TextUtility.parseIntegerObj(this
        .getUpdateCount()));
    tmpWorkflowStage.setCreatorID(TextUtility.parseIntegerObj(this
        .getCreatorID()));
    tmpWorkflowStage.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpWorkflowStage.setUpdaterID(TextUtility.parseIntegerObj(this
        .getUpdaterID()));
    tmpWorkflowStage.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpWorkflowStage;
  }

  public void setFormData(AbstractBaseObject baseObj)
      throws ApplicationException {
    WorkflowStage tmpWorkflowStage = (WorkflowStage) baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpWorkflowStage.getID()));
    this.setWorkflowRecordID(TextUtility.formatIntegerObj(tmpWorkflowStage
        .getWorkflowRecordID()));
    this.setStageName(tmpWorkflowStage.getStageName());
    this.setDuration(TextUtility.formatIntegerObj(tmpWorkflowStage.getDuration()));
    this.setRecordStatus(tmpWorkflowStage.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpWorkflowStage.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpWorkflowStage.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpWorkflowStage.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpWorkflowStage.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpWorkflowStage.getUpdateDate()));
  }
   
	public String getWorkflowGroupID() {
		return workflowGroupID;
	}
  
	public void setWorkflowGroupID(String workflowGroupID) {
		this.workflowGroupID = workflowGroupID;
	}
}